function [mar IR] = marcar(Im,W,alfa)
 [F C] = size(Im);
 [M N] = size(W);
 
 mar=zeros(M,N);
 flags=zeros(F,C);
 
 magI = sqrt(real(Im).^2 + imag(Im).^2);

 Itemp=magI;
 Om = (F+1)/2;                  % coordenadas del centro de la imagen
 On = (C+1)/2;
 sx = (F-1)/2;                  % factores de escala
 sy = (C-1)/2;

   
 R=0.5;
 a=2^(1/M);
 rmin=(a^(-M/2))*R;
 rmax=(a^(M/2))*R;
 
for xi = 1:F
   for yi = 1:C
      
    %u = ((xi - Om)/sx);
    %v = (((-1)*yi + On)/sy);
    
     u = ((xi - Om)/sx);
     v = ((yi - On)/sy);
     
     r= sqrt(u^2 + v^2);
        
    if (r >=rmin) && (r <rmax)
        
       theta = atan2(v,u);
       % theta=(180*theta1)/pi;
       l1 = abs(floor((log2(r)-log2(R))/log2(a))+M/2);
       %l1 = abs(floor((log(r/R)/(log(a)))+M/2)); 
       l2 = abs(floor((N*theta)/pi));
              
       if(l1>=0 && l1<M) && (l2>=0 && l2<N)
        if(flags(xi+1,yi+1)==0)   
           flags(xi+1,yi+1)=1;
         mar (l1+1,l2+1) = mar (l1+1,l2+1)+1;
            
         % IR (xi, yi) = I(l1,l2);
           magI(xi+1,yi+1)=Itemp(xi+1,yi+1)*(1+alfa*W(l1+1,l2+1));
         % magI(xi+1,yi+1)=magI(xi+1,yi+1)*(1+alfa*W(l1+1,l2+1));
        end 
       end
    end
  end
end
IR=magI;
end